<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 设计停车系统 -->
    <script>
      let parkingArray = []
      var ParkingSystem = function (big, medium, small) {
        parkingArray = [big, medium, small]
      }
      ParkingSystem.prototype.addCar = function (carType) {
        if (parkingArray[--carType] > 0) {
          parkingArray[carType]--
          return true
        }
        return false
      }
      console.log(ParkingSystem(['ParkingSystem', 'addCar', 'addCar', 'addCar', 'addCar'][([1, 1, 0], [1], [2], [3], [1])]))
    </script>
  </body>
</html>
